package com.atguigu.gmall.pay.config;

import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class OrderPayedRabbitConfiguration {

    @Bean
    public Exchange orderPayedExchange() {
        return ExchangeBuilder.directExchange("payed.exchange").durable(true).build() ;
    }

    @Bean
    public Queue payedQueue() {
        return QueueBuilder.durable("order.payed.queue").build() ;
    }

    @Bean
    public Binding orderPayedQueueBinding() {
        return BindingBuilder.bind(payedQueue()).to(orderPayedExchange()).with("order.payed").noargs() ;
    }

}
